package com.lorenzogao.pley.common.exception

/**
 * 作者：Lorenzo Gao
 * Date: 2017/12/29
 * Time: 13:28
 * 邮箱：2508719070@qq.com
 * Description:
 */
open class BaseException : Exception {



    var code: Int = 0

    var dispatymessage: String? = null

    constructor(message: String, code: Int, dispatymessage: String) : super(message) {
        this.code = code
        this.dispatymessage = dispatymessage
    }

    constructor(code: Int, dispatymessage: String) {
        this.code = code
        this.dispatymessage = dispatymessage
    }


    companion object {

        //Api错误
        val API_ERROR = 0x0
        //网络错误
        val NETWORD_ERROR = 0x1
        //http_错误
        val HTTP_ERROR = 0x2
        //fastjson错误
        val JSON_ERROR = 0x3
        //未知错误
        val UNKNOWN_ERROR = 0x4
        //运行是异常-包含定义异常
        val RUNTIME_ERROR = 0x6
        //无法解析该域名
        val UNKNOWNHOST_ERROR = 0x7
        //  无网络连接
        val SCOKET_ERROR = 0x8


        //服务器错误
        val ERROR_API_SYSTEM = 10000
        //登陆错误 用户名密码错误
        val ERROR_API_LOGIN = 10001
        //调用无权的API
        val ERROR_API_NO_PERMISSION = 10002
        //账户被冻结
        val ERROR_API_ACCOUNT_FREEZE = 10003

        val ERROR_TOKEN = 10010

        val ERROR_PARAMS = 0



        val error_http_400 = 400
        val error_http_404 = 404
        val error_http_405 = 405
        val error_http_500 = 500

    }

    constructor()

}